﻿using EcommerceRabbit.API.Application.Command.Trace;
using EcommerceRabbit.Servies.traceability;
using MediatR;

namespace EcommerceRabbit.API.Application.CommandHandler.Trace
{
    public class ImmunesAddCommandhandler : IRequestHandler<ImmunesAddCommand, int>
    {
        private readonly ITraceServices services;

        public ImmunesAddCommandhandler(ITraceServices services)
        {
            this.services = services;
        }

        public Task<int> Handle(ImmunesAddCommand request, CancellationToken cancellationToken)
        {
            return services.AddImmunes(new Ecommerce.Domain.Rabbit.Immune() { Iid = request.Iid, IDay = request.IDay, Immunemeans = request.Immunemeans, ImmuneWay = request.ImmuneWay, Cid = request.Cid });
        }
    }
}
